REST API Event Receiver Invalid URI

%3CLINGO-SUB%20id%3D%22lingo-sub-22716%22%20slang%3D%22en-US%22%3EREST%20API%20Event%20Receiver%20Invalid%20URI%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-22716%22%20slang%3D%22en-US%22%3E%3CP%3EI%20believe%20the%20metadata%20uri%26nbsp%3Breturned%20from%20the%20REST%20api%20for%26nbsp%3Bevent%20receivers%20is%20incorrect.%20The%20uri%20is%20in%20the%20format%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%5BSP%20Url%5D%2F_api%2FWeb%2F%3CSTRONG%3EEventReceiver%3C%2FSTRONG%3E%2FGetById(guid'%5BGUID%5D')%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ewhich%20is%20invalid.%20The%20correct%20uri%20should%20be%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%5BSP%20Url%5D%2F_api%2FWeb%2F%3CSTRONG%3EEventReceivers%3C%2FSTRONG%3E%2FGetById(guid'%5BGUID%5D')%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20this%20is%20true%2C%20how%20would%20you%20report%20this%20bug%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-23807%22%20slang%3D%22en-US%22%3ERe%3A%20REST%20API%20Event%20Receiver%20Invalid%20URI%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-23807%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20959px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F7319i446F912869CA5B39%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22EventReceiverInvalidURI.png%22%20title%3D%22EventReceiverInvalidURI.png%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EEvent%20Receiver%20Invalid%20URI%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EI%20wanted%20to%20add%20a%20screen%20shot%20to%20help%20explain%20this.%20Above%20is%20the%20raw%20output%20from%20the%20REST%20api%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ehttps%3A%2F%2F%5BSP%20Url%5D%2F_api%2Fweb%2Feventreceivers%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20%22id%22%20which%20is%26nbsp%3Bequal%20to%20the%26nbsp%3B__metadata.uri%20value%20is%20incorrect.%20On%20a%20side%20note%2C%20I%20wrote%20a%20blog%20post%20of%20adding%20event%20receivers%20using%20the%20REST%20api%20%3CA%20href%3D%22http%3A%2F%2Fdattabase.com%2Fadd-an-event-receiver-using-rest%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

I believe the metadata uri returned from the REST api for event receivers is incorrect. The uri is in the format:

 

[SP Url]/_api/Web/EventReceiver/GetById(guid'[GUID]')

 

which is invalid. The correct uri should be:

 

[SP Url]/_api/Web/EventReceivers/GetById(guid'[GUID]')

 

If this is true, how would you report this bug?

1 Reply
Highlighted

Event Receiver Invalid URIEvent Receiver Invalid URI

I wanted to add a screen shot to help explain this. Above is the raw output from the REST api:

 

https://[SP Url]/_api/web/eventreceivers

 

The "id" which is equal to the __metadata.uri value is incorrect. On a side note, I wrote a blog post of adding event receivers using the REST api here.